package com.zhentao.controller;

import com.zhentao.model.common.dtos.ResponseResult;
import com.zhentao.model.common.pojo.coupon.cdzdtos.CouponDTO;
import com.zhentao.model.common.pojo.coupon.cdzdtos.UserCouponDTO;
import com.zhentao.service.ICdzCouponService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author mp
 * @since 2024-12-18
 */
@RestController
@RequestMapping("/market/api/coupon")
public class CdzCouponController {
    @Autowired
    private ICdzCouponService cdzCouponService;

    @PostMapping("/page")
    /**
     * @description: 分页查询优惠券
     * @author: muhaoyang
     * @date: 2024/12/18 19:26
     * @param: [couponDTO]
     * @return: com.zhentao.model.common.dtos.ResponseResult
     **/
    public ResponseResult page(@RequestBody CouponDTO couponDTO){
        return cdzCouponService.CouponPage(couponDTO);
    }

    @PostMapping("/user/coupon/add")
    /**
     * @description:添加优惠卷
     * @author: muhaoyang
     * @date: 2024/12/19 9:37
     * @param: [couponId]
     * @return: com.zhentao.model.common.dtos.ResponseResult
     **/
    public ResponseResult addCoupon(@RequestBody UserCouponDTO userCouponDTO){
        return cdzCouponService.addCoupon(userCouponDTO);
    }

}
